# Contributor: Rasmus Thomsen <oss@cogitri.dev>
# Maintainer: Rasmus Thomsen <oss@cogitri.dev>
pkgname=iio-sensor-proxy
pkgver=3.0
pkgrel=5
pkgdesc="IIO sensors to D-Bus proxy"
url="https://gitlab.freedesktop.org/hadess/iio-sensor-proxy"
arch="all"
license="GPL-2.0-or-later"
depends="dbus"
makedepends="eudev-dev libgudev-dev glib-dev autoconf automake libtool
	gtk+3.0-dev gtk-doc
	"
subpackages="$pkgname-doc $pkgname-openrc"
source="https://gitlab.freedesktop.org/hadess/iio-sensor-proxy/uploads/de965bcb444552d328255639b241ce73/iio-sensor-proxy-$pkgver.tar.xz
	iio-sensor-proxy.initd
	0001-Revert-build-Check-for-.pc-files-before-using-them.patch
	0002-proximity-Get-near-level-from-sysfs-if-available.patch
	"

prepare() {
	default_prepare

	# Fix location of dbus configuration
	sed -e 's|^dbusconfdir = $(sysconfdir)|dbusconfdir = $(datadir)|' \
		-i data/Makefile.am

	autoreconf -if
}

build() {
	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
		--sysconfdir=/etc \
		--mandir=/usr/share/man \
		--localstatedir=/var \
		--with-geoclue-user=geoclue
	make
}

check() {
	make check
}

package() {
	make DESTDIR="$pkgdir" install

	install -Dm755 "$srcdir"/$pkgname.initd "$pkgdir"/etc/init.d/$pkgname
}

sha512sums="
50e84a5df006c34db07532bdb583142723ad610ade7dc495d0c1b076c7ef84564a60202a8be378173a429bd04dee10e8b33e5b7acc4b3dd810755cb831ebf2ea  iio-sensor-proxy-3.0.tar.xz
a34cb2e76b5d634f2e8def5e14c718c7b4ab9abbebf961bf9f420e64882241307d437f58a72dd70b5c7e4093d2e75da1fc166d6f4accc396fb9ca5d30e2b5e5f  iio-sensor-proxy.initd
5480763f85cb22fd7b1b791609baa3a4b251fc30a025b40aee2de584fa114686bf181a87a249ba4b0cb9080881ff55498baa7e496513bc39fa1af7c43253c465  0001-Revert-build-Check-for-.pc-files-before-using-them.patch
ceda9e69c78a84e0f8dfd242e401ad4d84e58ef54ea46de284890896b7adf75ab4b66a1a58305e2f554861005ba941912558749d00963008f14642a66b311cf9  0002-proximity-Get-near-level-from-sysfs-if-available.patch
"
